import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './pages/login/login.component';
import { AdminComponent } from './pages/admin/admin.component';
import { AdminDashboardComponent } from './pages/admin/shared/components/admin-dashboard/admin-dashboard.component';
import { AdminCarwashesComponent } from './pages/admin/shared/components/admin-carwashes/admin-carwashes.component';
import { AdminUsersComponent } from './pages/admin/shared/components/admin-users/admin-users.component';
import { AdminOrdersComponent } from './pages/admin/shared/components/admin-orders/admin-orders.component';
import { AdminSettingComponent } from './pages/admin/shared/components/admin-setting/admin-setting.component';
import {
  LOGIN_PAGE_TITLE,
  HOME_PAGE_TITLE,
  CARWASHES_PAGE_TITLE,
  ORDERS_PAGE_TITLE,
  SETTING_PAGE_TITLE,
  USERS_PAGE_TITLE,
  STAFFS_PAGE_TITLE,
} from './app-routing.namespace';
import { AdminStaffsComponent } from './pages/admin/shared/components/admin-staffs/admin-staffs.component';

const routes: Routes = [
  {
    path: 'login',
    component: LoginComponent,
    data: { title: LOGIN_PAGE_TITLE },
  },
  {
    path: '',
    component: AdminComponent,
    children: [
      {
        path: 'dashboard',
        component: AdminDashboardComponent,
        data: { title: HOME_PAGE_TITLE },
      },
      {
        path: 'carwashes',
        component: AdminCarwashesComponent,
        data: { title: CARWASHES_PAGE_TITLE },
      },
      {
        path: 'users',
        component: AdminUsersComponent,
        data: { title: USERS_PAGE_TITLE },
      },
      {
        path: 'orders',
        component: AdminOrdersComponent,
        data: { title: ORDERS_PAGE_TITLE },
      },
      {
        path: 'staffs',
        component: AdminStaffsComponent,
        data: { title: STAFFS_PAGE_TITLE },
      },
      {
        path: 'setting',
        component: AdminSettingComponent,
        data: { title: SETTING_PAGE_TITLE },
      },
      {
        path: '',
        redirectTo: '/dashboard',
        pathMatch: 'full',
      },
    ],
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}
